package richbar.com.richbar.adapter.home;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.common.util.LogUtil;
import com.okhttp.GlideUtil;

import java.util.ArrayList;
import java.util.List;

import richbar.com.richbar.R;
import richbar.com.richbar.bean.A;
import richbar.com.richbar.bean.GoodsBean;
import richbar.com.richbar.bean.GoodsListResult;
import richbar.com.richbar.bean.HomeGridBean;

/**
 * Created by QiYang on 2018/11/14.
 */

public class GridAdapter extends BaseQuickAdapter<HomeGridBean> {
    private int index;
    private int pageTotal;
    private List<HomeGridBean> data;
    public GridAdapter(int layoutResId, List<HomeGridBean> data,int index,int pageTotal) {
        super(layoutResId, data);
        this.data = data;
        this.index = index;
        this.pageTotal = pageTotal;
    }

    @Override
    public int getItemCount() {
        LogUtil.e("WWWWWWWWW",data.size() > (index + 1) * 8 ? 8 : data.size() - index * pageTotal);
        //再修改
        return 8;
    }

    @Override
    protected void convert(BaseViewHolder holder, HomeGridBean h) {
        int pos = holder.getAdapterPosition() + index * 8;
        HomeGridBean bean = data.get(pos);
        holder.setText(R.id.title,bean.getTitle());
        ImageView iv = holder.getView(R.id.pic);
        //GlideUtil.loadImage(mContext,bean.getPic(),iv);
    }

}
